Some client virtualization environments use chains of images to capture snapshots of virtual hard disks. One conventional image chain includes a base image (i.e., representing an entire physical disk drive) followed by forward delta images having sets of deltas (i.e., changed blocks and sectors) going forward in time. The base image resides at the tail of the chain and holds the oldest data, and the newest forward delta image resides at the head of the chain and holds the newest data.
To read a virtual sector from this conventional image chain, a program looks for the sector in the newest forward delta image at the head of the chain. If the sector resides in that forward delta image, the program retrieves the data from that forward delta image. However, if the sector does not reside in that forward delta image, the program then looks for the sector in the next forward delta image in the chain and so on until the program finds the sector. Ultimately, if the program reaches the tail of the chain without finding the sector in any of the forward delta images, the program looks for the sector in the base image at the tail of the chain. If the base image at the tail of the chain does not contain the sector, then the program assumes that the sector has never been written to, and the sector is therefore assumed to consist entirely of zeros.
There are deficiencies to the above-described conventional approach to using an image chain which includes a base image followed by forward delta images to capture snapshots of a virtual hard disk. For example, each operation to read current data incurs a time cost which linearly increases the farther that data is located from the head of the chain. Moreover, read performance further degrades as the image chain grows in length.
In contrast to the above-described conventional approach to capturing snapshots of a virtual hard disk (hereinafter referred to as the inefficient approach), a new approach to capturing snapshots of a virtual hard disk uses an image chain which includes a base image followed by backward delta images having sets of deltas going backward in time. In this new approach (hereinafter referred to as the more efficient approach), the base image resides near the head of the configuration and holds recent data, and an oldest backward delta image resides at the tail of the configuration and holds the oldest data.
To read a virtual sector from this image chain, a program looks for the sector in a delta image at the head of the chain. If the sector resides in that delta image, the program retrieves the data from that delta image. However, if the sector does not reside in that delta image, the program looks for the sector in the base image which immediately follows that delta image. Accordingly, the program is able to read current data quickly and inexpensively by accessing two images at most. That is, this more efficient approach optimizes the common case of reading current data (i.e., the newest data of the disk) over reading historical data (i.e., older data from a previous snapshot of the disk).